import java.util.Random;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 晓星航
 * Date: 2022-10-11
 * Time: 9:42
 */
public class TestDemo1 {
    public static int numOfOne2(int n){
        int count = 0;
        while (n != 0){
            count++;
            n = n & (n - 1);
        }
        return count;
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int ret = numOfOne(n);
        System.out.println(ret);
    }
    public static int numOfOne(int n) {
        int count = 0;
        while (n != 0){
            if ((n & 1) == 1){
                count++;
            }
            n= n >>> 1;
        }
        return count;
    }
    public static void main3(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int ret = numOfOne(n);
        System.out.println(ret);
    }
    public static void findNum(int n) {
        for (int i = 1; i <= n; i++) {
            int tmp = i;
            int count = 0;//数字的位数
            while (tmp != 0){
                count++;
                tmp /= 10;
            }
            tmp = i;
            int sum = 0;
            while (tmp != 0){
                sum += Math.pow(tmp%10,count);
                tmp /= 10;
            }
            if (sum == i){
                System.out.println(i);
            }
        }
    }
    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        findNum(n);
    }
    public static void main1(String[] args) {
        Random random = new Random();
        int rand = random.nextInt(100);
        Scanner scanner = new Scanner(System.in);
        while(true) {
            int n = scanner.nextInt();
            if (n > rand){
                System.out.println("猜大了");
            } else if (n < rand) {
                System.out.println("猜小了");
            } else {
                System.out.println("猜对了");
                break;
            }
        }
    }
}
